Script Hider is an invisible application that runs AppleScript (Or other OSA-compliant language) scripts. Script Hider was written in response to a Netter’s complaint: the person in question runs a Mac lab and has a monitoring script that gets launched at startup. Unfortunately, the students in his lab have a habit of quitting said script, since it is visible in the application menu and doesn’t look very important. The Netter was looking for a way to make his script invisible so people couldn’t mess with it. I got bored one afternoon, so here it is!
What’s with the two versions of Script Hider?
Script Hider comes in two “Flavors”: threaded and non-threaded.
The non-threaded version of Script Hider doesn’t need the Thread Manager. Each version has its advantages and drawbacks. See below.
How do I use the threaded version?
Simple. Make a folder in your Preferences Folder called “Invisible Scripts”. Make sure it’s at the top level of your Preferences Folder. Stuff whatever scripts (Or aliases to scripts) you want to run invisibly into that folder. Drop “Threaded Script Hider” into your System Folder and reboot. The scripts in your “Invisible Scripts” folder will be run at startup as if they were compiled as applications and placed in your “Startup Items” folder, except that they will be invisible. You can still quit the Threaded Script Hider, thereby killing all the scripts it’s running, by typing “quit app “Threaded Script Hider”” in the Script Editor.
How do I use the non-threaded version?
A little more complicated. For this one, you need a copy of Apple’s resource-editing utility, ResEdit, or a work-alike.
You need to make as many copies of the “Script Hider” extension as you have scripts you wish to run. (Don’t worry, the extension is small). Name the copies whatever you want. Put all of these copies in your Extensions folder. Make a folder at the top level of your Preferences Folder called “Invisible Scripts”, and put all the scripts (Or aliases to scripts) you want to run invisibly into that folder.
Here’s the tricky part. Open each copy of Script Hider with ResEdit and look for the ‘STR ’ resource (There’s only one). Change the contents of that resource to the name of a script in the “Invisible scripts” folder that you want to run. Make sure each copy you made has the name of a script in its resource fork, in that ‘STR ’ resource. Reboot. You’re done. You can still quit individual copies of the Script Hider, thereby killing the one script it’s running, by typing “quit app “<Name>”” in the Script Editor, where <Name> is what you named that copy.
What’s with the rigmarole with the unthreaded version?
The threaded version of Script Hider uses the Thread Manager to run all your invisible scripts simultaneously, within the same application. This is called “Multithreading”. The unthreaded version, obviously, can’t do this, so you need to make a separate copy for each script you want to run.
Gotchas
Beware: if you’re using the threaded version of Script Hider, you can’t write event handlers in your scripts other than “on run”, “on quit” and “on idle”. That means you can’t have applications like Eudora or others “notify” your invisible scripts with Apple Events. The reason for this is simple: the “notification” would get sent to the invisible Script Hider application. How would one decide which script would get to handle the notification, and which script’s reply would be sent back? If you need to run scripts that can receive notifications in this way, use the non-threaded version.
Advantages and drawbacks of each version
Threaded:
Pros:
• Takes less memory (The Threaded Script Hider extension it set to 200K, and that should be enough for a few scripts. Use ResEdit to edit the ‘SIZE’ resource in the extension if you need more memory).
• No complex installation — cleaner, overall: one extension can run as many scripts as you like.
Cons:
• Invisible scripts run by the threaded version can’t have Apple Events sent to them, which, notably, eliminates the popular pastime of writing AppleScript applications that can receive “notifications” from other applications.
Unthreaded:
Pros:
• Scripts can receive Apple Events.
Cons:
• Takes up way more memory — 200K per script (Just like a normal AppleScript application)
• Since multithreading isn’t available, you need to make a separate copy of the extension for each script you wish to run, and mess around in ResEdit to tell each copy which script to run.
Distribution of Script Hider
Script Hider is FREE; nothing that takes a day to write should be shareware. Give it to your friends; hand out copies on the streets. If you’re not satisfied with it, I’ll refund your money. ;-)
Future of Script Hider
This 1.0 version is “Quick-and-dirty”. If anyone has any bright ideas for the product, I’m open to suggestions. If you’d like to see changes or improvements made, give me a yell; my address is below. Notably, if enough people express an interest in this hack, I might write a Control Panel for it to eliminate some of the mucking around that’s currently necessary. Likewise, if you have any ((gasp)) bug reports, send them along.
Shameless plug
A much cooler product of mine, which I just recently finished, is called File Tracker. It watches files or folders for changes, and can take complex actions in response to various events. Unlike similar utilities, File Tracker can tell exactly *what* occurred when a file or folder changes. Hence, you can do things like backup all files that haven’t been modified for 2 days in a certain folder, and automatically expand any files arriving in that same folder. File Tracker ties in tightly with AppleScript, but also contains a built-in library of “pre-fab” actions for people who don’t want to mess with AppleScript or are too lazy to write their own scripts. :-). File Tracker is shareware $15 and should be available at the same place you got Script Hider. Write to me for more information.
Legal Stuff
I’m not responsible in any way for anything that may result from your usage of Script Hider. So there.
How to contact the author
Write to:
inra@musicb.mcgill.ca (InterNet) or...
Mark Aiken or SysOp at FidoNet node 1:167/106 or...